﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.Model;
using HZ.Supervise.Model.Enum;

namespace HZ.Supervise.Web.Message
{
    public partial class MessageListForType11 : BasePage
    {
        IBLL.IBLL_MessageTypeDetail ibllMessage = new BLL.BLL_MessageTypeDetail();
        public MessageListForType11()
        {
            this.ModuleNo = Module.预警处理.ToString();
            this.PageOperateType = OperateType.生产企业接收配送企业订单未响应.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindList();
            }
        }
        void BindList()
        {

            int count = 0;
            Model.MessageTypeDetail messType = new MessageTypeDetail();
            messType.UserId = CurrentAccount.UserID.ToString();
            messType.TypeId = 11;
            messType.Is_Del = false;
            messType.Is_Work = true;

            if (Request.QueryString["Is_Read"] == "1")//已读
            {
                gvwMessageList.DataSource = ibllMessage.GetMessageType(messType, 1, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out count);
                gvwMessageList.DataBind();
                AspNetPager1.RecordCount = count;
            }
            else//未读
            {
                gvwMessageList.DataSource = ibllMessage.GetMessageType(messType, 0, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out count);
                gvwMessageList.DataBind();
                AspNetPager1.RecordCount = count;
            }
        }

        protected void gvwMessageList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DirectByDetail")
            {
                GridViewRow row = ((Control)e.CommandSource).NamingContainer as GridViewRow;
                string _strMessDetailId = e.CommandArgument.ToString();
                ibllMessage.SetMessageIsRead(_strMessDetailId);//设置此消息为已读
                Response.Redirect("MessageCompanyDetailForType11.aspx?MessageDetailId=" + _strMessDetailId);
            }
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindList();
        }

        protected void btnDelte_Click(object sender, EventArgs e)
        {

        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            BindList();
        }
    }
}
